const cp = require('cp');
require('./page.css');
require('raty-js');
let moduleExport = {};
let arr_tag = ['全部模板', '科创', '运动', '时尚', '演出'];
let vm = avalon.define({
  $id: 'mc_step3_edit',
  tags: arr_tag,
  tagIndex: 0,
  templist: [],
  formatCommet: (count = 0) => {
    return count;
  },
  init: () => {
    cp.ajaxUrl({
      controller: 'shopskt',
      cmd: 'com.rel.porg.pb.com_find_temp_req',
      async: false,
      data: {},
      success: res => {
        vm.templist = res.templist;
      },
      fail: res => {
        cp.layerMsg(res.desc);
      },
    });
  },
  initRaty: () => {
    $('.star').raty({
      score: function() {
        return $(this).attr('data-score');
      },
      readOnly: true,
      starOn: require('./images/star-on.png'),
      starOff: require('./images/star-off.png'),
      starHalf: require('./images/star-half.png'),
    });
  },
});
vm.init();
moduleExport.content = require('./content.html');
moduleExport.vm = vm;
module.exports = moduleExport;
